/**
 * 
 */
package org.xserver.runtime.jetty.command;

import java.io.File;
import java.util.Properties;
import java.util.ResourceBundle;

import org.apache.commons.io.FilenameUtils;
import org.apache.log4j.Logger;
import org.xserver.Application;
import org.xserver.core.command.ICommand;

/**
 * @author jkonopka
 * 
 */
abstract class AbstractSettingsInitializeCommand implements ICommand {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8664521514033206495L;

	/**
	 * 
	 */
	private static final String RUNTIME_SETTINGS_XML = "runtime-settings.xml";

	private final Logger log = Logger.getLogger(getClass());
	private final ResourceBundle bundle = ResourceBundle.getBundle("settings");

	private final Properties properties;

	/**
	 * @param properties
	 */
	public AbstractSettingsInitializeCommand(Properties properties) {
		this.properties = properties;
	}

	/**
	 * @return the properties
	 */
	protected final Properties getProperties() {
		return properties;
	}

	/**
	 * @return File with path to user settings file
	 */
	protected final File getUserSettingsFile() {
		return new File(FilenameUtils.concat(Application.getUserConfPath(), RUNTIME_SETTINGS_XML));
	}

	/**
	 * @return the log
	 */
	protected final Logger getLog() {
		return log;
	}

	/**
	 * @return the bundle
	 */
	protected final ResourceBundle getBundle() {
		return bundle;
	}

}
